package com.yuyue.dronesystem.beans;

import java.util.Objects;

import com.yuyue.dronesystem.enums.PlaceType;

/**
 * Hospital
 */
public class Hospital extends Site {

    // 需求
    private Requirement requirement = new Requirement();

    public Hospital() {
    }

    public Hospital(Requirement requirement) {
        this.requirement = requirement;
    }

    public Hospital(Double longitude, Double latitude, String name, String note, Requirement requirement) {
        super(longitude, latitude, 0.0, name, note, PlaceType.HOSPITAL);
        this.requirement = requirement;
    }

    public Hospital(Double longitude, Double latitude, Double altitude, String name, String note, Requirement requirement) {
        super(longitude, latitude, altitude, name, note, PlaceType.HOSPITAL);
        this.requirement = requirement;
    }

    public Requirement getRequirement() {
        return this.requirement;
    }

    public void setRequirement(Requirement requirement) {
        this.requirement = requirement;
    }

    public Hospital requirement(Requirement requirement) {
        this.requirement = requirement;
        return this;
    }

    @Override
    public boolean equals(Object o) {
        if (o == this)
            return true;
        if (!(o instanceof Hospital)) {
            return false;
        }
        Hospital hospital = (Hospital) o;
        return super.equals((Site) o) && Objects.equals(requirement, hospital.requirement);
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), requirement);
    }

    @Override
    public String toString() {
        return "{" +
            " hospital='" + super.toString() + "'" +
            ", requirement='" + getRequirement() + "'" +
            "}";
    }
}